// 不带参数的类装饰器
// targetClass 就是 Customer类构造函数 本身
function FirstClassDecorator(targetClass: any) {
  let targetClassObj = new targetClass("张三")
  targetClassObj.buy()
  console.log(targetClass.name)
}
@FirstClassDecorator
class Customer {
  constructor(public name: string) {};
  sayName() { console.log("我是, ", this.name) };
  buy() { console.log(`${this.name}，已经下单了`) };
}

// 带参数的类装饰器
function HasParamClassDecorator(param: any) {
  console.log("param: ", param)
  return function(targetClass: any) {
    let targetClassObj = new targetClass("李四")
    targetClassObj.buy()
    console.log(targetClass.name)
  }
}
@HasParamClassDecorator('hello')
class Customer2 {
  constructor(public name: string) {};
  sayName() { console.log("我是, ", this.name) };
  buy() { console.log(`${this.name}，已经下单了`) };
}
export {}